<template>
  <div class="mui-numbox" data-numbox-min="1">
    <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
    <input
      id="test"
      class="mui-input-numbox"
      type="number"
      :value="incount"
      ref="nobox"
      @change="countChanged"
    />
    <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
  </div>
</template>

<script>
import mui from "../../../lib/mui/js/mui.js";
import {mapMutations} from 'vuex'
export default {
  data() {
    return {};
  },
  mounted() {
    mui(".mui-numbox").numbox();
  },
  methods: {
    countChanged() {
      const val =parseInt(this.$refs.nobox.value);
      //console.log(val);
      this.updateGoodsCount({id:this.id,count:val})
    },
    ...mapMutations(["updateGoodsCount"])
  },

  props:["incount","id"]
};
</script>

<style lang="scss" scoped>
</style>